package tasks;

import android.os.AsyncTask;
import android.util.Log;

import com.wenxin.administrator.zhufengfm.Constants;

import org.json.JSONException;
import org.json.JSONObject;

import client.ClientAPI;
import utils.EntityParseUtil;

/**
 * Created by Administrator on 15-10-20.
 */

public class DiscoverCategoryTask extends BaseTask{
    public DiscoverCategoryTask(TaskCallBack callBack) {
        super(callBack);
    }

    protected TaskResult doInBackground(String... strings) {
        TaskResult ret=new TaskResult();
        //action是唯一标示
        ret.action= Constants.TASK_ACTION_DISCOVER_CATEGORIES;
        JSONObject object= ClientAPI.getDiscoverCategories();
        if(object!=null)
        {
            try {
                ret.resultCode=object.getInt("ret");
                ret.data= EntityParseUtil.parseDiscoverCategories(object);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
        return ret;
    }





}
